<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>商品详情</title>
    <link href="__INDEX__/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
    <link rel="stylesheet" href="__INDEX__/css/style.css" />
    <link rel="stylesheet" href="__INDEX__/css/yund.css" />
</head>
<body>

	<header class="mui-bar mui-bar-nav show_bar_nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		<h1 class="mui-title">
				<a href="#sp" id='a_sp' onclick="set_color('a_sp')" class="goodsshow1">商品</a>
				<a href="#xq" id='a_xq' onclick="set_color('a_xq')" class="goodsshow2">详情</a>
				<a href="#pj" id='a_pj' onclick="set_color('a_pj')">评价</a>
		</h1>
	</header>

	
	<div class="mui-content" id="sp">
		<div class="xqy_cpimg" ><img src="{$goods_info.logo|default='__INDEX__/bg.png'}"></div>
		<div class="xqy_top" >
			<div class="spxq_nambox clearfix">
				<div class="spxq_nam" id="goods_name">{$goods_info['goods_name']}</div>
			</div>
			<div class="xqy_pribox">
				<span class="xqy_pri" id="current_price">¥{$goods_info['sale_price']|default='0.00'}</span>
				<span class="xqy_yj" id="original_price">原价：{$goods_info['cost_price']|default='0.00'}</span>
			</div>
			<ul class="xqy_klist clearfix">
				<li>销量：{$goods_info['sales']|default='0'}</li>
				<li >
					<div class="shopb_t_r" style="float: left; width: 100%;text-align: left;">
						<p>收藏：0人</p>
					</div>
				</li>
			</ul>
		</div>
		<div class="xqy_pjbox" id="pj">
			<p class="xqy_pjicon"><span class="iconfont icon-icon_order"></span>评价</p>
			<div class="xqy_pjnr">
				<p class="xqy_pjbt">宝贝评价</p>
				<ul class="xqy_pjlist">
						<li>
							<div class="xqy_pjlis_mem">
								<span class="xqy_pjlis_memtx"><img src=""></span>
								<span class="xqy_pjlis_memnam"></span>
								<span class="pjstar star010"></span>
							</div>
							<div class="xqy_pjlis_time">
								<span></span>
							</div>
							<div class="xqy_pjlis_info"></div>
						</li>
				</ul>
				<div class="xqy_pjbtn evaluation">
					<a href="{:url('shop/comment_list',['goods_id'=>$goods_info['id']])}">查看全部评价</a>
				</div>
			</div>
		</div>
		<div class="xqy_conbox" id="xq">
			<p class="xqy_pjicon"><span class="iconfont icon-tupian"></span>商品详情</p>
			<div class="xqy_spxq" id="summary">
				{$goods_info['content']|html_entity_decode}
			</div>
		</div>
	</div>
	<nav class="mui-bar mui-bar-tab spxq_bar_tab"  id="footer-list">
		<a class="mui-tab-item" href="" >
			<span class="mui-icon iconfont icon-shangcheng"></span>
			<span class="mui-tab-label" >店铺</span>
		</a>
		<a class="mui-tab-item" id="go_shop2" href="{:url('shop/shopcart')}">
			<span class="mui-icon iconfont icon-gouwuche1"></span>
			<span class="mui-tab-label" >购物车</span>
		</a>
		<a class="mui-tab-item" onclick="add_collect()" style='color: #FFAA2B;'>
			<span class="mui-icon iconfont icon-xingxing"></span>
			<span class="mui-tab-label">收藏</span>
		</a>
		<a class="mui-tab-item add_cart" id='add_cart'  onclick="add_cart()">加入购物车</a>
		<a class="mui-tab-item add_lijgm" href="{:url('goods/goods_buy',['goods_id'=>$goods_info['id']])}">立即购买</a>
	</nav>
</body>
</html>
{include file="public/footer" /}
<script>
	function add_cart(){
		layer.confirm('您确定加入购物车吗？', {
			btn: ['确定', '取消'] //按钮
		}, function() {
			$.ajax({
				type:"post",
				url: "{:url('index/goods/add_cart')}",
				data: {goods_id :"{$goods_info['id']}"},//表单数据
				success: function(data) {
					layer.msg(data.msg);
				}
			})
		})
	}
	
	function add_collect(){
		$.ajax({
				type:"post",
				url: "{:url('index/goods/add_collect')}",
				data: {goods_id :"{$goods_info['id']}"},//表单数据
				success: function(data) {
					layer.msg(data.msg, {
					  icon: 1,
					  time: 1000 //2秒关闭（如果不配置，默认是3秒）
					}, function(){
						  if(data.code == 200) {
							 location.reload();
						  }
					}); 
				}
			})
	}
	
	function set_color(id){
		$("#a_sp").css("color","white");  
		$("#a_xq").css("color","white");  
		$("#a_pj").css("color","white");  
		
		$("#"+id).css("color","#62C471"); 
	}
</script>